using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SkeletonMoveState : SkeletonGroundState
{
    public SkeletonMoveState(Enemy enemyBase, EnemyStateMachine enemyStateMachine, string animatorName, Enemy_Skeleton enemy) : base(enemyBase, enemyStateMachine, animatorName, enemy)
    {
    }

    public override void Enter()
    {
        base.Enter();
    }

    public override void Exit()
    {
        base.Exit();
    }

    public override void Update()
    {
        base.Update();
        enemy.rigid.velocity = new Vector2(enemy.moveSpeed* enemy.faceDir, rb.velocity.y);
        if (!enemy.isGround() || enemy.IsWall())
        {
            enemy.Flip();
            enemyStateMachine.ChangeState(enemy.skeletonIdleState); 
        }
    }
}
